<?php

// No direct access
 
defined('_JEXEC') or die('Restricted access');
?>
<div id="subHeader">
	<div class="login">
		<img alt="Sartu" src="<?php echo JURI::root();?>templates/lingolangtemplate/images/kandadoa.jpg">
		<div><a class="morea" href="index.php?option=com_user&view=login">Sartu zure kontuan</a></div>
	</div>
	<a id="img1" class="atalak gorria" href="index.php?option=com_hizkuntzak&task=whoSpeaks">
		<div class="atalText"><?php echo $this->rsc->menu_who; ?></div>
	</a>
	<a id="img2" class="atalak morea" href="index.php?option=com_hizkuntzak&task=showLangDetails">
		<div class="atalText "><?php echo $this->rsc->menu_first; ?></div>
	</a>
	<a id="img3" class="atalak current"href="index.php?option=com_hizkuntzak&task=qas">
		<div class="atalText"><?php echo $this->rsc->menu_qa; ?></div>
	</a>
	<a id="img5" class="atalak berdea" href="index.php?option=com_hizkuntzak&task=numbers">
		<div class="atalText"><?php echo $this->rsc->menu_numbers; ?></div>
	</a>
	<a id="img4" class="atalak urdina" href="index.php?option=com_hizkuntzak&task=songs">
		<div class="atalText"><?php echo $this->rsc->menu_songs; ?></div>
	</a>
</div>
<div id="left">
	<div id="menu">
		<ul>
		<?php
			$color = 0;
			$text_color = "gorria";
			foreach($this->langs as $la){
				if ($color == 0) {
					$text_color = "gorria";
					$color++;
				}else if($color == 1){
					$text_color = "morea";
					$color++;
				}else if ($color == 2) {
					$text_color = "laranja";
					$color++;
				}else if ($color == 3) {
					$text_color = "urdina";
					$color++;
				}else if ($color == 4) {
					$text_color = "berdea";
					$color = 0;
				}
				if($this->c_lang == 'eu-ES'){

					if ($la->iso_code == $this->lang->iso_code) {
						print("<li class='selected'><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_eu</a></li><br/>");# code...
					} else{
						print("<li ><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_eu</a></li><br/>");
					}
				}else{
					if ($la->iso_code == $this->lang->iso_code) {
						print("<li class='selected'><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_es</a></li><br/>");
					} else{
						print("<li ><a class='$text_color' href='index.php?option=com_hizkuntzak&task=mainMenu&hlang=$la->iso_code'>$la->name_es</a></li><br/>");
					}
				}
			};
		?>
		<?php
		if($this->show){
			?>
			<br/>
			<hr/>
			<br/>
			<a href="index.php?option=com_hizkuntzak&task=adminHizkuntzak" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
			<span class="ui-button-text"><?php echo $this->rsc->admin_title; ?></span></a>
		<?php }?>
		</ul>
	</div>
</div>
<div id="content">
		<?php
		if($this->show){
			?>
		<a href="index.php?option=com_hizkuntzak&task=createQasLang&hlang=<?php echo($this->lang->iso_code);?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
		<span class="ui-button-text"><?php echo $this->rsc->edit; ?></span></a>
		<br/>
		<br/>
		<hr/>
		<?php }?>
		<?php 
			if(count($this->qasLang)==0){
				?>
				<div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all"> 
					<p>
						<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
						<strong><?php echo($this->rsc->main_no_words);?></strong>
					</p>
				</div>
			<?php 
			}
			else{
				?>
				<div id="contleft">
					<ul>
						<?php
						foreach($this->qasLang as $qa){
							if($this->c_lang == 'eu-ES'){
								echo("<li><a href='#q".$qa->qa->id."' id='q".$qa->qa->id."' name='q".$qa->qa->id."' class='qasLink'>".$this->rsc->qa_q.": ".$qa->qa->q_eu."</a></li>");
								echo("<li><a href='#a".$qa->qa->id."' id='a".$qa->qa->id."' name='a".$qa->qa->id."' class='qasLink'>".$this->rsc->qa_a.": ".$qa->qa->a_eu."</a></li>");
							}
							else{
								echo("<li><a href='#q".$qa->qa->id."' id='q".$qa->qa->id."' name='q".$qa->qa->id."' class='qasLink'>".$this->rsc->qa_q.": ".$qa->qa->q_es."</a></li>");
								echo("<li><a href='#a".$qa->qa->id."' id='a".$qa->qa->id."' name='a".$qa->qa->id."' class='qasLink'>".$this->rsc->qa_a.": ".$qa->qa->a_es."</a></li>");
							}
							echo("<input type='hidden' id='q".$qa->qa->id."-s' value='$qa->q_spelling' />");
							echo("<input type='hidden' id='q".$qa->qa->id."-p' value='$qa->q_pronoun' />");
							echo("<input type='hidden' id='q".$qa->qa->id."-v' value='$qa->q_videoPath' />");
							echo("<input type='hidden' id='a".$qa->qa->id."-s' value='$qa->a_spelling' />");
							echo("<input type='hidden' id='a".$qa->qa->id."-p' value='$qa->a_pronoun' />");
							echo("<input type='hidden' id='a".$qa->qa->id."-v' value='$qa->a_videoPath' />");
							echo("<br/>");
						}
						?>
					</ul>
				</div>

				<div id="contright">
						<video width="480" height="360" autoplay="true" poster="<?php echo JURI::root();?>components/com_hizkuntzak/img/no-video.jpg" id="videoWord">
							<source id="srcwebm" src="<?php echo($this->qasLang[0]->q_videoPath);?>.webm" type="video/webm" />
							<source id="srcogg" src="<?php echo($this->qasLang[0]->q_videoPath);?>.ogg" type="video/ogg" />
							<source id="srcmp4" src="<?php echo($this->qasLang[0]->q_videoPath);?>.mp4" type="video/mp4" />
							<object id="srcobj" width="480" height="360" src="<?php echo($this->qasLang[0]->q_videoPath);?>.mp4" >
								<embed id="srcemb" width="480" height="360" src="<?php echo($this->qasLang[0]->q_videoPath);?>.flv" >
									<?php echo $this->rsc->no_support ?>: <a href="<?php echo($this->qasLang[0]->q_videoPath);?>.mp4" id="dfile"><?php echo $this->rsc->file ?></a>
								</embed>
								</object>
						</video>
						<div id="play_button">
							<a href="#" id="button_link" ><img src="<?php echo JURI::root();?>components/com_hizkuntzak/img/play.png" alt="Play"/></a>
						</div>
					<center>
						<p id='spelling'><?php echo($this->qasLang[0]->q_spelling);?></p>
						<p id='pronoun'><?php echo($this->qasLang[0]->q_pronoun);?></p>
					</center>
				</div>
		<?php
			}
		?>
</div>